<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子25-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子25

                const result1 = [1, 5, 10, 15].find((value, index, arr) => value > 9);
                console.log(result1); // 10

                const result2 = [1, 5, 10, 15].findIndex((value, index, arr) => value > 9);
                console.log(result2); // 2

                //--------------------------------------------------------------------------

                function f(v){
                    return v > this.age;
                }
                let person = {name: 'John', age: 20};
                [10, 12, 26, 15].find(f, person);    // 26
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/25.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>